import request from "@/utils/request";
import type { getSkuListResponseData } from "./type";
enum API {
  // 获取sku列表的接口地址
  SKULIST_URL = "/admin/product/list/",
  // 下架sku的接口地址
  CANCELSALESKU_URL = "/admin/product/cancelSale/",
  // 上架sku的接口地址
  ONSALESKU_URL = "/admin/product/onSale/",
  // 获取skuInfo的接口地址
  SKUINFO_URL = "/admin/product/getSkuInfo/",
  // 删除sku的接口地址
  DELETESKU_URL = "/admin/product/deleteSku/",
}
// 获取sku列表的接口地址
export const reqSkuList = (page: number, limit: number) =>
  request.get<any, getSkuListResponseData>(
    API.SKULIST_URL + `${page}/${limit}`
  );
// 下架sku的接口
export const reqCancelSaleSku = (skuId: number) =>
  request.get<any, any>(API.CANCELSALESKU_URL + skuId);
// 上架sku的接口
export const reqOnSaleSku = (skuId: number) =>
  request.get<any, any>(API.ONSALESKU_URL + skuId);
// 获取sku列表的接口
export const reqSkuInfo = (skuId: number) =>
  request.get<any, any>(API.SKUINFO_URL + skuId);
// 删除sku的接口
export const deleteSku = (skuId: number) =>
  request.delete<any, any>(API.DELETESKU_URL + skuId);
